package net.sourceforge.openforecast;

/** Defines a consistent interface that must be implemented by all Forecasting Models. Note that any forecasting model
 * should first be initialized by calling init. Once init has been called, any of the other methods can be expected to
 * return reasonable results. */
public interface ForecastingModel extends EvaluationModel {
	/** Returns a one or two word name of this type of forecasting model. Keep this short. A longer description should
	 * be implemented in the toString method.
	 * 
	 * @return a string representation of the type of forecasting model implemented. */
	String getForecastType();

	boolean isInitialized();

	/** Returns the number of predictors used by the underlying model.
	 * 
	 * @return the number of predictors used by the underlying model. */
	int getNumberOfPredictors();

	/** Used to initialize the model-specific parameters and customize them to the given data set. This method must be
	 * called before any other method in the class.
	 * 
	 * @param dataSet a data set of observations that can be used to initialize the forecasting parameters of the
	 *        forecasting model. */
	void init(DataSet dataSet);

	/** Using the current model parameters (initialized in init), apply the forecast model to the given data point. The
	 * data point must have valid values for the independent variables. Upon return, the value of the dependent variable
	 * will be updated with the forecast value computed for that data point.
	 * 
	 * @param dataPoint the data point for which a forecast value (for the dependent variable) is required.
	 * @return the same data point passed in but with the dependent value updated to contain the new forecast value. */
	double forecast(DataPoint dataPoint);

	/** Using the current model parameters (initialized in init), apply the forecast model to the given data set. Each
	 * data point in the data set must have valid values for the independent variables. Upon return, the value of the
	 * dependent variable will be updated with the forecast values computed.
	 * 
	 * @param dataSet the set of data points for which forecast values (for the dependent variable) are required.
	 * @return the same data set passed in but with the dependent values updated to contain the new forecast values. */
	DataSet forecast(DataSet dataSet);
}